<?php

/**
 * Tarea filter form base class.
 *
 * @package    universidad
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseTareaFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'encargado_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Miembro'), 'add_empty' => true)),
      'creador_id'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'estado'             => new sfWidgetFormChoice(array('choices' => array('' => '', 'pendiente' => 'pendiente', 'aceptada' => 'aceptada', 'rechazada' => 'rechazada', 'cancelada' => 'cancelada', 'terminada' => 'terminada'))),
      'fecha_maxima'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'pre_observaciones'  => new sfWidgetFormFilterInput(),
      'post_observaciones' => new sfWidgetFormFilterInput(),
      'tarea_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Tarea'), 'add_empty' => true)),
      'created_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'nombre'             => new sfValidatorPass(array('required' => false)),
      'encargado_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Miembro'), 'column' => 'id')),
      'creador_id'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'estado'             => new sfValidatorChoice(array('required' => false, 'choices' => array('pendiente' => 'pendiente', 'aceptada' => 'aceptada', 'rechazada' => 'rechazada', 'cancelada' => 'cancelada', 'terminada' => 'terminada'))),
      'fecha_maxima'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'pre_observaciones'  => new sfValidatorPass(array('required' => false)),
      'post_observaciones' => new sfValidatorPass(array('required' => false)),
      'tarea_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Tarea'), 'column' => 'id')),
      'created_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('tarea_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Tarea';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'nombre'             => 'Text',
      'encargado_id'       => 'ForeignKey',
      'creador_id'         => 'Number',
      'estado'             => 'Enum',
      'fecha_maxima'       => 'Date',
      'pre_observaciones'  => 'Text',
      'post_observaciones' => 'Text',
      'tarea_id'           => 'ForeignKey',
      'created_at'         => 'Date',
      'updated_at'         => 'Date',
    );
  }
}
